<include file="public@header" />
</head>
<php>
	unset($cateList[0]);
</php>
<body>
<div class="wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('article/index')}">{:lang('文章管理')}</a></li>
		<li><a href="{:url('article/add')}">{:lang('添加文章')}</a></li>
		<li class="active"><a href="{:url('article/edit')}">{:lang('文章编辑')}</a></li>
	</ul>
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('article/edit')}">
		<div class="form-group">
			<label for="input-title" class="col-sm-2 control-label"><span class="form-required">*</span>{:lang('标题')}</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" name="title" value="{$data.title}">
			</div>
		</div>

		<div class="form-group">
			<label for="input-desc" class="col-sm-2 control-label"><span class="form-required"></span>{:lang('描述')}</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" name="desc" value="{$data.desc}">
			</div>
		</div>

		<div class="form-group">
			<label for="input-desc" class="col-sm-2 control-label"><span class="form-required"></span>{:lang('链接')}</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" name="url" value="{$data.url}">
			</div>
		</div>

		<div class="form-group">
			<label for="input-cate" class="col-sm-2 control-label"><span class="form-required"></span>{:lang('分类')}</label>
			<div class="col-md-6 col-sm-10">
				<select class="form-control" name="cate">
					<volist name="cateList" id="vo" key="k">
						<option value="{$key}" {$key == $data->getData('cate') ? 'selected' : ''}>{$vo}</option>
					</volist>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label for="input-index" class="col-sm-2 control-label"><span class="form-required"></span>{:lang('首页显示')}</label>
			<div class="col-md-6 col-sm-10">
				<select class="form-control" name="is_index">
					<option value="0" {$data.is_index == 0 ? 'selected' : ''}>否</option>
					<option value="1" {$data.is_index == 1 ? 'selected' : ''}>是</option>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label for="input-image" class="col-sm-2 control-label"><span class="form-required"></span>{:lang('图片')}</label>
			<div class="col-md-6 col-sm-10">
				<input type="hidden" name="image" id="image" value="{$data.image}">
				<a href="javascript:uploadOneImage('图片上传','#image');">
					<img src="{:cmf_get_image_url($data.image)}" id="image-preview" style="cursor: pointer;max-width:100px;" class="img-responsive">
				</a>
			</div>
		</div>

		<div class="form-group">
			<label for="input-content" class="col-sm-2 control-label"><span class="form-required"></span>{:lang('详情')}</label>
			<div class="col-md-6 col-sm-10">
				<script type="text/plain" id="content" name="content" {$data.content|default=''}></script>
			</div>
		</div>

		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" name="id" value="{$data.id}">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('确定')}</button>
			</div>
		</div>
	</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>

<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
	//编辑器路径定义
	var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
	$(function () {
		editorcontent = new baidu.editor.ui.Editor();
		editorcontent.render('content');
		try {
			editorcontent.sync();
		} catch (err) {
		}

		$('.btn-cancel-thumbnail').click(function () {
			$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
			$('#thumbnail').val('');
		});

		$('#more-template-select').val("{$post.more.template|default=''}");
	});

</script>
</html>